package com.sky.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.mapper.SetmealDishMapper;
import com.sky.mapper.SetmealMapper;
import com.sky.mapper.UserSetmealMapper;
import com.sky.result.PageResult;
import com.sky.service.UserSetmealService;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserSetmealServiceImpl implements UserSetmealService {
    private static final Logger log = LoggerFactory.getLogger(UserSetmealServiceImpl.class);
    @Autowired
    UserSetmealMapper setmealMapper;


    @Autowired
    SetmealDishMapper setmealDishMapper;



    /**
     * 根据分类id查套餐
     * @param categoryId
     * @return
     */
    @Override
    public List<Setmeal> getSetmealByCategoryId(String categoryId) {

        List<Setmeal> setmealList = setmealMapper.selectByCategoryId(categoryId);

        return setmealList;
    }

    /**
     * 根据套餐id查询对应的菜品集合
     * @param id
     * @return
     */
    @Override
    public List<DishItemVO> getDishBySetmealId(Long id) {
        List<DishItemVO> dishItemVOList = setmealMapper.getDishBySetmealId(id);
        return dishItemVOList;
    }
}
